package com.tj.jinzao.presenter;

import com.tj.jinzao.api.SubscriberCallBack;
import com.tj.jinzao.base.BasePresenter;
import com.tj.jinzao.base.IBaseView;
import com.tj.jinzao.model.Label;
import com.tj.jinzao.model.ResultResponse;

import java.util.List;

/**
 * 标签处理
 * Created by wjy 2018/12/10.
 */
public class LabelPresenter extends BasePresenter<IBaseView<List<Label>>> {

    public LabelPresenter(IBaseView<List<Label>> view) {
        super(view);
    }

    public void getLabelList() {
        addSubscription(mApiService.getArticleLabel(), new SubscriberCallBack<List<Label>>(mView.getContext()) {
            @Override
            protected void onSuccess(List<Label> list) {
                if (mView != null) mView.onRequestSuccess(list);
            }

            @Override
            protected void onFailure(ResultResponse response) {
                if (mView != null) mView.onRequestError(response.getMessage());
            }

            @Override
            protected boolean isShowProgress() {
                return true;
            }
        });
    }

}
